package com.falidos.utilidades.conexao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao {
	private static Conexao conexao;
	private static Connection con;
	
	static { con = null; }
	static { conexao = null; }	
	
	public Conexao(){			
		try {
			Class.forName("org.postgresql.Driver");
			con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres","ueg");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}			
	}
	
	public static Conexao obterInstancia(){
		if(conexao == null)
			conexao = new Conexao();
		return conexao;
	}
	
	public Connection getConexao(){
		return con;
	}
}
